package leetcode.tree;

import leetcode.tree.common.TreeNode;

/**
 * @author mazouri
 * @create 2021-05-03 22:01
 */
public class _104_maxDepth {
    public int maxDepth(TreeNode root) {
        if (root == null) return 0;
        int left = maxDepth(root.left);
        int right = maxDepth(root.right);

//        if (left > right) {
//            return left + 1;
//        } else {
//            return right + 1;
//        }
        return Math.max(left, right) + 1;
    }
}
